import { mock } from 'mockjs';

export default [
    // 登录接口
    {
        url: '/api/login',
        method: 'post',
        response: ({ body }) => {
            //获取请求体携带过来的用户名与密码
            const { username, password } = body;
            const data = {
                token: '123456789',
                user: '张三',
                sex: '男',
                image: 'https://img1.baidu.com/it/u=728383910,3448060628&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800',
            }
            if (username == 'admin' && password == 123456) {
                return { code: 200, data: { data } };
            } else {
                return { code: 201, data: { msg: '账号密码错误' } };
            }

        },
    },
];



//用户信息数据
function createUserList() {
    return [
        {
            userId: 1,
            avatar:
                "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
            username: "admin",
            password: "111111",
            desc: "平台管理员",
            roles: ["平台管理员"],
            buttons: ["cuser.detail"],
            routes: ["home"],
            token: "Admin Token",
        },
        {
            userId: 2,
            avatar:
                "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
            username: "system",
            password: "111111",
            desc: "系统管理员",
            roles: ["系统管理员"],
            buttons: ["cuser.detail", "cuser.user"],
            routes: ["home"],
            token: "System Token",
        },
    ];
}
